home *** CD-ROM | disk | FTP | other *** search
- ************************************************************
- * *
- * I/O Opcode 9 - STATUS *
- * *
- * This procedure will check the status of a file. If it *
- * is open, it gets the information from the FDR in *
- * memory. Otherwise, it has to call GETFDR to read it *
- * from disk. *
- * *
- * Register Usage: *
- * R1 - Points to FDR in memory *
- * R2 - The status byte as we build it *
- * *
- ************************************************************
-
- STAT0
- ANDI R12,>FF00
- AI R12,24
-
- CLR R2
-
- LDCR @B02,4
- BLWP @IFO See if file is open
- JNE STAT1
-
- * The file is open - See if we're at EOF
- *
- MOV @62(R5),R3 Get current sector/record #
- MOV @54(R5),R4 Get pointer in buffer
-
- MOV @4(R5),R1 Get address of FDR
- LDCR @2(R5),4 Select bank with FDR
-
- SWPB R3
- C R3,@18(R1)
- JNE STAT12
-
- * If the file is empty, we're at the end of file
-
- C @ZERO,@18(R1)
- JEQ STAT10
-
- MOVB @12(R1),R0 Get file flags
- ANDI R0,>8000 Check for variable records
- JEQ STAT10
- LDCR @B02,4
- LDCR @3(R5),4 Select bank with buffer
- CB *R4,@B255 Check for end of sector marker
- JNE STAT11
- STAT10 ORI R2,>0100
- STAT11 LDCR @B02,4
- LDCR @2(R5),4 Select bank with FDR
- STAT12
- JMP STAT3
-
- STAT1 BL @GETFDR
- CI R5,0
- JNE STAT2
-
- ORI R2,>8000 File does not exist
- JMP STAT7
-
- STAT2 LDCR @ZERO,4
- MOV R5,R1
-
- STAT3
-
- * Check to see if file is protected
-
- MOV @12(R1),R0 Get file flags
- COC @PROBIT,R0 Check protection bit
- JNE STAT4
-
- ORI R2,>4000
-
- STAT4
-
- * Check for DISPLAY or INTERNAL
-
- MOV @12(R1),R0
- ANDI R0,>0200
- JEQ STAT5
-
- ORI R2,>1000
-
- STAT5
-
- * Check for program file
-
- MOV @12(R1),R0
- ANDI R0,>0100
- JEQ STAT6
-
- ORI R2,>0800
-
- STAT6
-
- * Check for FIXED or VARIABLE
-
- MOV @12(R1),R0
- ANDI R0,>8000
- JEQ STAT7
-
- ORI R2,>0400
-
- STAT7
- * Now store the status in byte 8 of the caller's PAB
-
- LDCR @ZERO,4 Select RAM bank 0
- MOV @PABADR,R3
- AI R3,8
- ORI R3,>4000
- SWPB R3
- MOVB R3,@VDPWA
- SWPB R3
- MOVB R3,@VDPWA
- NOP
- MOVB R2,@VDPWD
-
- B @DSRRT
-